const fs = require('fs-extra'),
    path = require('path');
/**
 * 获取指定路径信息
 * @param {string} targetPath  <必选> 目标路径
 * @returns object 路径信息，包含其类型、扩展名、目录名
 */
module.exports = targetPath=>{
    let result = {},
        stat = fs.statSync(targetPath);
    result.type = stat.isFile() ? 'file' :
        stat.isDirectory ? 'dir' :
        stat.isSymbolicLink ? 'link' :
        stat.isSocket ? 'socket' :
        'other';
    result.extname = path.extname(targetPath).slice(1);
    result.dirPath = path.dirname(targetPath);
    return result;
};